package com.postaop.hntl.front.iso8583;

import java.util.Map;
import java.util.TreeMap;

/**
 * 消息模板
 * @author Karma
 */
public class IsoMsgTemplate {
	//ascii类型消息类型
	public static IsoFieldProperty MSG_TYPE_ALPHA;
	//binary类型消息类型
	public static IsoFieldProperty MSG_TYPE_BIN;
	static{
		IsoElementProperty le=new IsoElementProperty();
		le.setLength(4);
		le.setMsgType(IsoMsgType.FIXED);
		le.setDataType(IsoDataType.ALPHA);
		MSG_TYPE_ALPHA=IsoFieldPropertyUtils.createFixedField(le);
		
		le=new IsoElementProperty();
		le.setLength(2);
		le.setMsgType(IsoMsgType.FIXED);
		le.setDataType(IsoDataType.BIN);
		MSG_TYPE_BIN=IsoFieldPropertyUtils.createFixedField(le);
	}
	//消息类型的域类型
	private IsoFieldProperty msgTypeFieldProperty=MSG_TYPE_BIN;
	private Map<Integer,IsoFieldProperty> fieldsMap
	=new TreeMap<Integer, IsoFieldProperty>();
	//报文头长度
	private int isoHeadLength=11;
	//位图域长度
	private int bitMapLength=8;
	
	public void setField(Integer index,IsoFieldProperty property){
		fieldsMap.put(index, property);
	}
	
	public IsoFieldProperty getField(Integer index){
		return fieldsMap.get(index);
	}
	

	public IsoFieldProperty getMsgTypeFieldProperty() {
		return msgTypeFieldProperty;
	}

	public void setMsgTypeFieldProperty(IsoFieldProperty msgTypeFieldProperty) {
		this.msgTypeFieldProperty = msgTypeFieldProperty;
	}

	public int getIsoHeadLength() {
		return isoHeadLength;
	}

	public void setIsoHeadLength(int isoHeadLength) {
		this.isoHeadLength = isoHeadLength;
	}

	public int getBitMapLength() {
		return bitMapLength;
	}

	public void setBitMapLength(int bitMapLength) {
		this.bitMapLength = bitMapLength;
	}
}
